<template>
  <div class="index">
    <lottery :beforeLottery="beforeLottery" :lotteryBtn="lotteryBtn" :prizesList="prizesList"
    :prizesBgLightList="prizesBgLightList"
    :prize="prize" :afterLottery="afterLottery"></lottery>
  </div>
</template>


<script type="text/javascript">

  import lottery from '@/components/lottery';

  export default {
      data() {
          return {
              prize:0,
              prizesList:[
                  // {
                  //   imgUrl: require('./images/icon-lottery-prize4.png'),
                  //   text: 'baomingxing'
                  // },
                  // {
                  //   imgUrl: require('./images/icon-lottery-prize2.png'),
                  //   text: 'baomingxing1'
                  // },
                  // {
                  //   imgUrl: require('./images/icon-lottery-prize1.png'),
                  //   text: 'baomingxing2'
                  // },
                  require('./images/icon-lottery-prize4.png'),
                  require('./images/icon-lottery-prize2.png'),
                  require('./images/icon-lottery-prize1.png'),
                  require('./images/icon-lottery-prize3.png'),
                  require('./images/icon-lottery-prize5.png'),
                  require('./images/icon-lottery-prize6.png'),
                  require('./images/icon-lottery-prize7.png'),
                  require('./images/icon-lottery-prize8.png'),
              ],
              // prizesBgLightList:[
              //     require('./images/icon-lottery-prize2.png'),
              //     require('./images/icon-lottery-prize4.png'),
              //     require('./images/icon-lottery-prize3.png'),
              //     require('./images/icon-lottery-prize1.png'),
              //     require('./images/icon-lottery-prize6.png'),
              //     require('./images/icon-lottery-prize5.png'),
              //     require('./images/icon-lottery-prize8.png'),
              //     require('./images/icon-lottery-prize7.png'),
              // ],
              lotteryBtn:{
                  img : require('./images/icon-lottery-btn.png')
              }
          };
      },
      methods:{
          beforeLottery(resolve,reject){

          /*
          * send ajax to get result and pass to child component
          **/ 
          
          // get result : this.prize
              setTimeout(()=>{
                  this.prize = 7;
                  resolve();
              },10);

          },
          afterLottery(){
              alert('draw'+ this.prize);
          }
      },
      components:{
          lottery:lottery
      }
  };
</script>

<style type="text/css">
</style>